package csu.web.mypetstore.web.servlet;


import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import csu.web.mypetstore.domain.SMSverification;


@WebServlet("/sendSMS")
public class SendSmsServlet extends HttpServlet {

    /** serialVersionUID*/
    private static final long serialVersionUID = 1L;

    @Override
    public void doPost(HttpServletRequest req, HttpServletResponse resp)
            throws ServletException, IOException {
        String phone=req.getParameter("phone");
        System.out.println(phone);
        //根据获取到的手机号发送验证码
        SMSverification verification = new SMSverification();
        String code = verification.sendverfication(phone);
        System.out.println(code);
        resp.getWriter().print(code);
    }
}

